-
Notifications
You must be signed in to change notification settings - Fork 370
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(maven): do not track registries when fetching requirements #1466
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1466 +/- ##
==========================================
- Coverage 67.32% 67.08% -0.24%
==========================================
Files 192 192
Lines 18161 18164 +3
==========================================
- Hits 12226 12185 -41
- Misses 5283 5324 +41
- Partials 652 655 +3 ☔ View full report in Codecov by Sentry. |
@@ -132,7 +132,8 @@ func (e Extractor) Extract(ctx context.Context, input *filesystem.ScanInput) ([] | |||
} | |||
overrideClient.AddVersion(root, reqs) | |||
|
|||
client.PreFetch(ctx, overrideClient, reqs, filepath.Join(input.Root, input.Path)) | |||
// TODO: only run `PreFetch` for deps.dev client | |||
// client.PreFetch(ctx, overrideClient, reqs, filepath.Join(input.Root, input.Path)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what's the impact on performance of this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this depends on which registry client we are using, for this pom.xml:
- with deps.dev client: the performance is worse, with runtime from 20s to 1m
- with native registry: the runtime improved from more than 10m to 10s
for reference, it takes mvn
about 25s to resolve without any local cache.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM - we can revisit whether prefetching some endpoints works for the native maven client in future.
#1447
When fetching requirements of a Maven dependency, we should not keep track of the registries defined in pom.xml of dependencies. Doing that will add a lot irrelevant registries to the client and sends unnecessary requests, and finally slows down the resolution.
This PR also disables
PreFetch
in Maven transitive scanning.PreFetch
callsMatchVersions
which sends requests tomaven-metadata.xml
for native Maven client.maven-metadata.xml
is not necessarily needed for all dependencies. DisablingPreFetch
will save us from making requests to these files. However, callingPreFetch
should be fine for deps.dev client, and this can be a TODO in the future.With this fix, resolving pom.xml is now shortened to 10-20 seconds.